import axios from "./server.js"
const BaseUrl="http://guoxiao158.top"
const apiConfig={
    getinfo:BaseUrl+"/nwt/getinfo.php",
    getAd:BaseUrl+"/nwt/getad.php",
    getExact:BaseUrl+"/nwt/getinterview.php",
    getList:"../../static/list.json",
}

//export default apiConfig
const MapKey="c178e0083d967474db6698fbcb2eeb03"
export const getContact = () => {
  return axios.get(apiConfig.getinfo).then(res => res.data); // security/sys-users
};
export const getAd = () => {
  return axios.get(apiConfig.getAd).then(res => res.data); // security/sys-users
};
export const getExact = (params) => {
  return axios.get(apiConfig.getExact+"?page="+params).then(res => res.data); // security/sys-users
};
//获取 周边首页
export const getList = (params) => {
  return axios.get(apiConfig.getList).then(res => res.data); // security/sys-users
};
//获取地理位置
export const getAddress = (lng,lat) => {
  var url=`https://restapi.amap.com/v3/geocode/regeo?location=${lng},${lat}&key=${MapKey}`
  return axios.get(url).then(res => res.data); // security/sys-users
};
//搜索结果
export const getSearch = (lng,lat,keyword) => {
  var url=`https://restapi.amap.com/v3/place/around?key=${MapKey}&location=${lng},${lat}&keywords=${keyword}`
  return axios.get(url).then(res => res.data); // security/sys-users
};
//查询关键字列表

export const getKeyList = (keyword) => {
  var url=`https://restapi.amap.com/v3/place/text?city=beijing&keywords=${keyword}&xml&page=1&key=${MapKey}&extensions=all`
  return axios.get(url).then(res => res.data); // security/sys-users
};
//根据id获取详情
export const getDetail = (id) => {
  var url=`https://restapi.amap.com/v3/place/detail?id=${id}&key=${MapKey}`
  return axios.get(url).then(res => res.data); // security/sys-users
};
